import {ref} from 'vue'
import deepClone from '@/utils/deepClone';

export const useCustomComponentConfig = <T>(obj: T) => {
    const configData = ref<T>()
    const getConfig = () => {
        const _obj: T = deepClone(obj)
        for (const key in _obj) {
            if (Array.isArray(_obj[key as keyof T])) {
                delete _obj[key as keyof T]
            }
        }
        configData.value = _obj
    }

    return {
        getConfig,
        configData
    }
}